package com.heima.search.web;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dto.ArticleDto;
import com.heima.model.search.dto.SearchDto;
import com.heima.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api/v1/article/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    @PostMapping("/search")
    public ResponseResult<List<ArticleDto>> search(@RequestBody SearchDto dto) throws IOException {
        //接收参数
        //调用service
        //响应结果
        return searchService.search(dto);
    }
}
